home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 5 / Amiga Tools 5.iso / grafik / 3d & render tools / irit / man / man6 / animation.6 < prev    next >
Text File  |  1996-07-16  |  6KB  |  156 lines

  1. .TH Animation
  2.  6 "IRIT Version 6.0" 
  3. .SH NAME
  4. Animation
  5.  
  6.  
  7.  
  8. The animation tool adds the capability of animating objects using
  9. forward kinematics, exploiting animation curves.  Each object has
  10. different attributes, that prescribe its motion, scale, and visibility
  11. as a function of time. Every attribute has a name, which designates
  12. it's role. For instance an attribute animation curve named MOV_X
  13. describes a translation motion along the X axis.
  14.  
  15. .SH How to create animation curves in IRIT
  16.  
  17.  
  18.  
  19. Let OBJ be an object in IRIT to animate.
  20.  
  21. Animation curves are either scalar (E1/P1) curves or three dimensional
  22. (E3/P3) curves with one of the following names:
  23.  
  24.      MOV_X, MOV_Y, MOV_Z            Translation along one axis 
  25.      MOV_XYZ                        Arbitrary translation along all three axes
  26.      ROT_X, ROT_Y, ROT_Z            Rotating around a single axis (degrees)
  27.      SCL_X, SCL_Y, SCL_Z            Scale along a single axis  
  28.      SCL                            Global scale               
  29.      VISIBLE                        Visibility                 
  30.  
  31.  
  32. The visibility curve is a scalar curve that enables the display of
  33. the object if the visibility curve is positive at time t and disables
  34. the display (hide) the object if the visibility curve is negative at
  35. time t.
  36.  
  37. The animation curves are all attached as an attribute named "animation"
  38. to the object OBJ.
  39.  
  40. Example:
  41.     mov_x = cbezier( ctlpt( E1, 0.0 ),
  42.                      ctlpt( E1, 1.0 ) );
  43.     scl   = cbezier( ctlpt( E1, 1.0 ),
  44.                      ctlpt( E1, 0.1 ) );
  45.     rot_y = cbezier( ctlpt( E1, 0.0 ),
  46.                      ctlpt( E1, 0.0 ) );
  47.                      ctlpt( E1, 360.0 ) );
  48.     attrib(OBJ, "animation", list( mov_x, scl, rot_y ) );
  49.  
  50. To animate OBJ between time zero and one (Bezier curves are always
  51. between zero and one), by moving it a unit size in the X direction,
  52. scaling it to %10 of its original size and rotating it at increasing
  53. angular speed from zero to 360 degrees.
  54.  
  55. OBJ can now be save into a file or displayed via one of the regular
  56. viewing commands in IRIT (i.e. VIEWOBJ).
  57.  
  58. Animation is not always between zero and one. To that end one can
  59. apply the CREPARAM function to modify the parametric domain of the
  60. animation curve. The convention is that if the time is below the
  61. starting value of the parametric domain, the starting value of the
  62. curve is used.  Similarly if the time is beyond the end of the
  63. parameter domain of the animation curve, the end value of the
  64. animation curve is used.
  65.  
  66. Example:
  67.     CREPARAM( mov_x, 3.0, 5.0 );
  68.  
  69. to set the time of the motion in the x axis to be from t = 3 to
  70. t = 5.  for t < 3, mov_x(3) is used, and for t > 5, mov_x(5) is
  71. employed.
  72.  
  73. the animation curves are regular objects in the IRIT system. Hence,
  74. only one object named mov_x or scl can exist at one time. If you
  75. create a new object named mov_x, the old one is overwritten! To
  76. preserve old animation curves you can detach the old ones by executing
  77. 'free(mov_x)' that removes the object named mov_x from IRIT's object
  78. list but not from its previous used locations within other list
  79. objects, if any. For example:
  80.  
  81.     mov_x = cbezier( ctlpt( E1, 0.0 ),
  82.                      ctlpt( E1, 1.0 ) );
  83.     attrib(obj1, "animation", list( mov_x ) );
  84.     free(mov_x);
  85.  
  86.     mov_x = cbezier( ctlpt( E1, 2.0 ),
  87.                      ctlpt( E1, 3.0 ) );
  88.     attrib(obj2, "animation", list( mov_x ) );
  89.     free(mov_x);
  90.  
  91. .SH A more complete animation example
  92.  
  93.  
  94.  
  95.   a = box( vector( 0, 0, 0 ), 1, 1, 1 );
  96.   b = box( vector( 0, 0, 0 ), 1, 1, 1 );
  97.   c = box( vector( 0, 0, 0 ), 1, 1, 1 );
  98.   d = sphere( vector( 0, 0, 0), 0.7 );
  99.   
  100.   pt0   =  ctlpt( e1,  0.0 );
  101.   pt1   =  ctlpt( e1,  1.0 );
  102.   pt2   =  ctlpt( e1,  2.0 );
  103.   pt6   =  ctlpt( e1,  6.0 );
  104.   pt360 =  ctlpt( e1,  360.0 );
  105.   
  106.   pt10 = ctlpt( e1, -4.0 );
  107.   pt11 = ctlpt( e1,  1.0 );
  108.   pt12 = ctlpt( e1,  4.0 );
  109.   pt13 = ctlpt( e1, -1.0 );
  110.   
  111.   visible = creparam( cbezier( list( pt10,  pt11 ) ), 0.0, 5.0 );
  112.   mov_x   = creparam( cbezier( list( pt0, pt6, pt2 ) ), 0.0, 1.2 );
  113.   mov_y   = mov_x;
  114.   mov_z   = mov_x;
  115.   rot_x   = creparam( cbspline( 2,
  116.                                 list( pt0, pt360, pt0 ),
  117.                                 list( KV_OPEN ) ),
  118.                       1.2, 2.5 ); 
  119.   rot_y   = rot_x;
  120.   rot_z   = rot_x;
  121.   scl     = creparam( cbezier( list( pt1, pt2, pt1, pt2, pt1 ) ),
  122.                       2.5, 4.0 );
  123.   scl_x   = scl;
  124.   scl_y   = scl;
  125.   scl_z   = scl;
  126.   mov_xyz = creparam( circle( vector( 0, 0, 0 ), 2.0 ), 4.0, 5.0 );
  127.   
  128.   attrib( d, "animation", list( mov_xyz, visible ) );
  129.   free( visible );
  130.   
  131.   visible = creparam( cbezier( list( pt12,  pt13 ) ), 0.0, 5.0 );
  132.   
  133.   attrib( a, "animation", list( rot_x, mov_x, scl, scl_x, visible ) );
  134.   attrib( b, "animation", list( rot_y, mov_y, scl, scl_y, visible ) );
  135.   attrib( c, "animation", list( rot_z, mov_z, scl, scl_z, visible ) );
  136.   
  137.   color( a, red );
  138.   color( b, green );
  139.   color( c, blue );
  140.   color( d, cyan );
  141.   
  142.   demo = list( a, b, c, d );
  143.   
  144.   interact( demo );
  145.   viewanim( 0, 5, 0.01 );
  146.  
  147. In this example, we create four objects, three cubes and one sphere.
  148. Animation curves to translate the three cubes along the three axes for
  149. the time period of t = 0 to t = 1.2 are created. Rotation curves to
  150. rotate the three cubes along the three axes are then created for time
  151. period of t = 1.2 to t = 2.5. Finally, for the time period of t = 2.5
  152. to t = 4.0. the cubes are (not only) unifomly scaled. For the time
  153. period of t = 4 to t = 5, the cubes become invisible and the sphere,
  154. that becomes visible, is rotated along a circle of radius 2.
  155.  
  156.